/**
 * Created by linxiaofen on 2017/6/5.
 */
'use strict';
app.controller('indexCtrl',['$rootScope', '$window', '$location', '$log',   function ($rootScope, $window, $location, $log){
    var ctrl = this;
    var locationChangeStartOff = $rootScope.$on('$locationChangeStart', locationChangeStart);
    function locationChangeStart(event, newUrl, currentUrl) {
        var url = decodeURIComponent(newUrl);
        var uri = url.slice(url.indexOf("#!/main") + 8,url.lastIndexOf("/?")>0?url.lastIndexOf("/?"):url.length);
        setActive();
        function setActive() {
            if (uri == "profile") {
                ctrl.status=1;
            } else if (uri == "resume") {
                ctrl.status=2;
            } else if (uri == "portfolio") {
                ctrl.status=3;
            } else if (uri == "contact" ) {
                ctrl.status=5;
            } else{
                ctrl.status=4;
            }
            sessionStorage.setItem("status",ctrl.status);
        }

    }
}]);